from configparser import ConfigParser
import os
class ConfigReader:
    def __init__(self,file_name):
        self.config = ConfigParser()
        config_path = os.path.split(os.path.realpath(__file__))[0] + os.sep + file_name
        print(config_path)
        # 读取文件信息
        self.config.read(config_path)
    def get_config(self,config_item):
        for section in self.config.sections():
            if self.config.has_option(section, config_item):
                return self.config.get(section,config_item)

# if __name__ == '__main__':
#     config = ConfigReader('config.ini')
#     print(config.get_config("dev_base_url"))
    # print(os.path.split(os.path.realpath(__file__))[0] + os.sep)
    # print(os.path.split(os.path.realpath(__file__))[0] + os.sep + 'config.ini')